<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>原生的ajax</title>
</head>
<body>
    
    <script>
        

        {
            // 原生的ajax

            var xhr = null;
            xhr = new XMLHttpRequest();

            xhr.open('get',url,true);

            xhr.onreadystatechange = function () {
                if (xhr.readyState===4 && /^2\d{2}$/.test(xhr.status)) {
                    console.log(xhr.reponseText);
                }
            }

            xhr.send();

        }
    
    </script>


</body>
</html>